package com.yuexun.beilunpatient.ui.my.presenter.impl;


import com.yuexun.beilunpatient.ui.bean.BaseListEntity;
import com.yuexun.beilunpatient.ui.my.model.IUpdateUsrMsgModel;
import com.yuexun.beilunpatient.ui.my.presenter.IUpdateUsrMsgPresenter;
import com.yuexun.beilunpatient.ui.my.ui.view.IUpdateUsrMsgView;

import java.util.Map;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by chenss on 2018/8/8 0008.
 */

public class UpdateUsrMsgPresenter implements IUpdateUsrMsgPresenter {

    private IUpdateUsrMsgView view;
    private IUpdateUsrMsgModel model;

    //记录Log

    public UpdateUsrMsgPresenter(IUpdateUsrMsgModel model, IUpdateUsrMsgView view) {
        this.model = model;
        this.view = view;
    }

    @Override
    public void updateOaAccount(Map<String, String> praise) {
        model.updateOaAccount(praise)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<BaseListEntity>() {

                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
//                        ViewInject.toast("消息列表获取失败");
                    }

                    @Override
                    public void onNext(BaseListEntity baseBean) {
                        view.updateOaAccount(baseBean);
                    }
                });
    }
}
